package form;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import phantrang.PT_MuaHang;

import trangchu.UtilDelegate;

public class DSJ_NhanVien extends UtilDelegate {
	public String MaNV;
	public String HoTenNV;
	public String GioiTinh;
	public String NgaySinh;
	public String DiaChi;
	public String DienThoai;
	public String Email;
	public String SoTaiKhoan;
	public String NganHang;
	public String VaiTroql;
	public String day;
	public String TenNH;

	
	public String getDay() {
		return day;
	}


	public void setDay(String day) {
		this.day = day;
	}


	public String getTenNH() {
		return TenNH;
	}


	public void setTenNH(String tenNH) {
		TenNH = tenNH;
	}


	public String getMaNV() {
		return MaNV;
	}


	public void setMaNV(String maNV) {
		MaNV = maNV;
	}


	public String getHoTenNV() {
		return HoTenNV;
	}


	public void setHoTenNV(String hoTenNV) {
		HoTenNV = hoTenNV;
	}


	public String getGioiTinh() {
		return GioiTinh;
	}


	public void setGioiTinh(String gioiTinh) {
		GioiTinh = gioiTinh;
	}


	public String getNgaySinh() {
		return NgaySinh;
	}


	public void setNgaySinh(String ngaySinh) {
		NgaySinh = ngaySinh;
	}


	public String getDiaChi() {
		return DiaChi;
	}


	public void setDiaChi(String diaChi) {
		DiaChi = diaChi;
	}


	public String getDienThoai() {
		return DienThoai;
	}


	public void setDienThoai(String dienThoai) {
		DienThoai = dienThoai;
	}


	public String getEmail() {
		return Email;
	}


	public void setEmail(String email) {
		Email = email;
	}


	public String getSoTaiKhoan() {
		return SoTaiKhoan;
	}


	public void setSoTaiKhoan(String soTaiKhoan) {
		SoTaiKhoan = soTaiKhoan;
	}


	public String getNganHang() {
		return NganHang;
	}


	public void setNganHang(String nganHang) {
		NganHang = nganHang;
	}


	public String getVaiTroql() {
		return VaiTroql;
	}


	public void setVaiTroql(String vaiTroql) {
		VaiTroql = vaiTroql;
	}


	public Vector<DSJ_NhanVien> getUsers(){
		Vector<DSJ_NhanVien> getNhanVien = new Vector<DSJ_NhanVien>();
		Connection con =UtilDelegate.getConnection();		
		PreparedStatement st;
		try {
			st = con.prepareStatement("select *, CONVERT(varchar,NgaySinh ,103) 'day' from NhanVien join VaiTroQL on NhanVien.VaiTroql = VaiTroQL.MaVT join CacNganHang on NhanVien.NganHang = CacNganHang.MaNH");
			ResultSet rs = st.executeQuery();
						
				while(rs.next()){
					
					String MaNV = rs.getString("MaNV");
					String HoTenNV = rs.getString("HoTenNV");
					String GioiTinh = rs.getString("GioiTinh");
					String day = rs.getString("day");
					String DiaChi = rs.getString("DiaChi");
					String DienThoai = rs.getString("DienThoai");
					String Email = rs.getString("Email");
					String SoTaiKhoan = rs.getString("SoTaiKhoan");
					String TenNH = rs.getString("TenNH");
					String VaiTro = rs.getString("VaiTro");
					
					DSJ_NhanVien b = new DSJ_NhanVien();
					b.setMaNV(MaNV);
					b.setHoTenNV(HoTenNV);
					b.setGioiTinh(GioiTinh);
					b.setDiaChi(DiaChi);
					b.setDienThoai(DienThoai);
					b.setEmail(Email);
					b.setSoTaiKhoan(SoTaiKhoan);
					b.setDay(day);
					b.setTenNH(TenNH);
					b.setVaiTroql(VaiTro);
					getNhanVien.add(b);
									
				}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return getNhanVien;
	}
}

